
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../../../global/css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./frm.css" />
</head>
<body>
	<div id="main">
        <div id="system-container" class="system-msg-wrapper aui-hide">
            <div class="system-msg-container" tapmode onclick="ccn() && views.openSystemMsgWin();">
                <div class="system-msg-icon">
                    <div class="aui-badge unread-count">10</div>
                    <img src="../../../global/image/msg-system.png" />
                </div>
                <div class="system-msg-content">x条新系统消息</div>
                <i class="aui-iconfont aui-icon-right"></i>
            </div>
        </div>
		<div id="common-msg-block">
            <div class="part-title-frame auix-header-bx">
                <div class="part-title">通知</div>
            </div>
			<!-- 注意: 这几项，tpl的id必须跟这里的id严格按照 这里的id加前缀 'tpl-'的规则。代码里依赖了 -->
			<div id="hotpost-item" class="aui-list aui-media-list"></div>
			<div id="reply-item" class="aui-list aui-media-list"></div>
			<div id="laud-item" class="aui-list aui-media-list"></div>
            <div id="system-item" class="aui-list aui-media-list aui-hide"></div>
            <div id="task-item" class="aui-list aui-media-list aui-hide"></div>
		</div>

		<div id="conv-list-block">
            <div class="part-title-frame auix-header-bx">
                <div class="part-title aui-hide">私信</div>
            </div>
		    <section>
		        <ul id="conv-list" class="aui-list aui-media-list"></ul>
			</section>
		</div>
	</div>
    <div id="no-msg" class="aui-hidex">
        <p>这里静悄悄 ^v^</p>
    </div>
    
    <div id="goTop" class="aui-hide" tapmode onclick="goTop(this);">
        <img src="../../../global/image/go-top.png" >
    </div>

</body>

<script id="tpl-conv-item" type="text/x-dot-template">
    <li class="aui-list-item aui-list-item-middle" id="im-{{=it.convId}}" data-slide="0" data-conv="{{=it.conv}}" data-msgStatus="{{=it.msgStatus}}" data-rongId="{{=it.targetId}}" data-nick="{{=decodeEmoji(it.nick)}}" tapmode onclick="ccn() && openChat(this);">
        <div class="aui-media-list-item-inner" ontouchstart="imCellTouchStart(event)" ontouchend="imCellTouchEnd(event)">
            <div class="aui-list-item-media wechat-avatar">
                <div class="aui-dot" data-unreads="{{=it.unreadCount}}"></div>
                <div class="aui-badge unread-count {{=hideOn0(it.unreadCount)}}">{{=emptyOn0(it.unreadCount)}}</div>
	            <img src="{{=it.avatar}}" />
            </div>
            <div class="aui-list-item-inner" style="width: calc(100% - 2.5rem);">
                <div class="aui-list-item-text">
                    <div class="aui-list-item-title nick">{{=decodeEmoji(it.nick)}}</div>
                    <div class="aui-list-item-right time">{{=it.time}}</div>
                </div>
                <div class="aui-list-item-text aui-font-size-12 content">
                    <p class="aui-ellipsis-1">{{=genMsgHtmlCont(it)}}</p>
                    <div class="aui-list-item-right"><img class="no-disturb" src="../../../global/image/no_disturb.png"/></div>
                </div>
            </div>
        </div>
        <div class="item-delete" tapmode onclick="imCellDelete(event)">
            <div>删除</div>
        </div>
    </li>
</script>

<script id="tpl-system-item" type="text/x-dot-template">
    <div class="aui-list-item aui-list-item-middle" tapmode onclick="ccn() && views.openSystemMsgWin();">
        <div class="aui-media-list-item-inner">
            <div class="aui-list-item-media wechat-avatar">
                <div id="system_unread_badge" class="aui-badge unread-count {{=hideOn0(it.unreadCount)}}">{{=emptyOn0(it.unreadCount)}}</div>
                <img src="../../../global/image/msg-system.png" />
            </div>
            <div class="aui-list-item-inner" style="width: calc(100% - 2.5rem);">
                <div class="aui-list-item-text">
                    <div class="aui-list-item-title">系统消息</div>
                    <div id="system_item_time" class="aui-list-item-right">{{=vdate4Msg(it.dateline)}}</div>
                </div>
                <div class="aui-list-item-text aui-font-size-12 content">
                    <p class="aui-ellipsis-1" id="system_item_content">{{=decodeEmoji(it.title)}}</p>
                </div>
            </div>
        </div>
    </div>
</script>

<script id="tpl-hotpost-item" type="text/x-dot-template">
    <div class="aui-list-item aui-list-item-middle" tapmode onclick="views.openToplineWin();">
        <div class="aui-media-list-item-inner">
            <div class="aui-list-item-media wechat-avatar">
                <div id="topline_unread_badge" class="aui-badge unread-count {{=hideOn0(it.unreadCount)}}">{{=emptyOn0(it.unreadCount)}}</div>
	            <img src="../../../global/image/msg-hot.png" />
            </div>
            <div class="aui-list-item-inner" style="width: calc(100% - 2.5rem);">
                <div class="aui-list-item-text">
                    <div class="aui-list-item-title">今日头条</div>
                    <div id="topline_item_time" class="aui-list-item-right">{{=vdate4Msg(it.dateline)}}</div>
                </div>
                <div class="aui-list-item-text aui-font-size-12 content">
                    <p class="aui-ellipsis-1" id="topline_item_content">{{=decodeEmoji(it.title)}}</p>
                </div>
            </div>
        </div>
	</div>
</script>

<script id="tpl-reply-item" type="text/x-dot-template">
    <div class="aui-list-item aui-list-item-middle" tapmode onclick="ccn() && views.openReplyListWin();">
        <div class="aui-media-list-item-inner">
            <div class="aui-list-item-media wechat-avatar">
                <div id="comment_unread_badge" class="aui-badge unread-count {{=hideOn0(it.unreadCount)}}">{{=emptyOn0(it.unreadCount)}}</div>
                {{? it.ph}}
    	            <img id="comment_item_avatar" src="../../../global/image/msg-reply.png" />
                {{??}}
                    <img id="comment_item_avatar" src="../../../global/image/noavatar_M.gif" data-type="avatar" data-src="{{=avatarUrlById(it.replyinfo.uid)}}" class="aui-img-round" />
                {{?}}
            </div>
            <div class="aui-list-item-inner" style="width: calc(100% - 2.5rem);">
                <div class="aui-list-item-text">
                    <div class="aui-list-item-title">评论通知</div>
                    <div id="comment_item_time" class="aui-list-item-right">{{=vdate4Msg(it.dateline)}}</div>
                </div>
                <div class="aui-list-item-text aui-font-size-12 content">
                    {{? it.ph}}
                        <p class="aui-ellipsis-1" id="comment_item_content">{{=decodeEmoji(it.title)}}</p>
                    {{??}}
                        <p class="aui-ellipsis-1" id="comment_item_content">{{=decodeEmoji(it.replyinfo.username)}}：{{=decodeEmoji(it.replyinfo.content)}}</p>
                    {{?}}
                </div>
            </div>
        </div>
	</div>
</script>

<script id="tpl-laud-item" type="text/x-dot-template">
    <div class="aui-list-item aui-list-item-middle" tapmode onclick="ccn() && views.openLaudListWin();">
        <div class="aui-media-list-item-inner">
            <div class="aui-list-item-media wechat-avatar">
                <div id="land_unread_badge" class="aui-badge unread-count {{=hideOn0(it.unreadCount)}}">{{=emptyOn0(it.unreadCount)}}</div>
                {{? it.ph}}
    	            <img id="land_item_avatar" src="../../../global/image/msg-laud.png" />
                {{??}}
                    <img id="land_item_avatar" src="../../../global/image/noavatar_M.gif" data-type="avatar" data-src="{{=avatarUrlById(it.recommondinfo.uid)}}" class="aui-img-round" />
                {{?}}
            </div>
            <div class="aui-list-item-inner" style="width: calc(100% - 2.5rem);">
                <div class="aui-list-item-text">
                    <div class="aui-list-item-title">点赞通知</div>
                    <div id="land_item_time" class="aui-list-item-right">{{=vdate4Msg(it.dateline)}}</div>
                </div>
                <div class="aui-list-item-text aui-font-size-12 content">
                    {{? it.ph}}
                        <p class="aui-ellipsis-1" id="land_item_content">{{=decodeEmoji(it.title)}}</p>
                    {{??}}
                        <p class="aui-ellipsis-1" id="land_item_content">{{=decodeEmoji(it.recommondinfo.username)}} 给你点了个赞</p>
                    {{?}}
                </div>
            </div>
        </div>
	</div>
</script>
<!-- 任务通知 -->
<script id="tpl-task-item" type="text/x-dot-template">
    <div class="aui-list-item aui-list-item-middle" tapmode onclick="ccn() && views.openPushTask();">
        <div class="aui-media-list-item-inner">
            <div class="aui-list-item-media wechat-avatar">
                <div id="task_unread_badge" class="aui-badge unread-count {{=hideOn0(it.unreadCount)}}">{{=emptyOn0(it.unreadCount)}}</div>
                <img src="../../../global/image/task-notice.png" />
            </div>
            <div class="aui-list-item-inner" style="width: calc(100% - 2.5rem);">
                <div class="aui-list-item-text">
                    <div class="aui-list-item-title">任务通知</div>
                    <div id="task_item_time" class="aui-list-item-right">{{=vdate4Msg(it.dateline)}}</div>
                </div>
                <div class="aui-list-item-text aui-font-size-12 content">
                    {{? it.ph}}
                        <p class="aui-ellipsis-1" id="task_item_content">{{=it.title}}</p>
                    {{??}}
                        <p class="aui-ellipsis-1" id="task_item_content"> {{=it.title}}</p>
                    {{?}}
                </div>
            </div>
        </div>
	</div>
</script>


<script type="text/javascript" src="../../../config.js"></script>
<script type="text/javascript" src="../../../global/script/lib/api.js"></script>
<script type="text/javascript" src="../../../global/script/lib/doT.min.js"></script>
<script type="text/javascript" src="../../../global/script/libx/myRongIM.js"></script>
<script type="text/javascript" src="../../../global/script/libx/myBadge.js"></script>
<script type="text/javascript" src="../../../global/script/libx/dateUtil.js"></script>
<script type="text/javascript" src="../../../global/script/lib/zepto.min.js"></script>
<script type="text/javascript" src="../../../global/script/lib/aui-lazyload.js"></script>
<script type="text/javascript" src="../../../global/script/mylib.js"></script>
<script type="text/javascript" src="../../../app.js"></script>
<script type="text/javascript" src="./pmsg.js"></script>
<script type="text/javascript" src="./frm.js"></script>
<script type="text/javascript" src="./del.js"></script>
<script type="text/javascript" src="./blacklist.js"></script>
<script type="text/javascript" src="./utils.js"></script>
<script type="text/javascript" src="./listens.js"></script>

</html>


<script type="text/javascript" src="../../../global/script/_fakeapi.js"></script>
<script type="text/javascript">
	window.mockNewMsgPrepend = {
		result: {
			message: {
				extra: "",
				sentStatus: "SENT",
				messageId: 21,
				sentTime: 1501040183448,
				conversationType: "PRIVATE",
				messageDirection: "RECEIVE",
				receivedStatus: "UNREAD",
				content: {
					extra: "helloExtra",
					text: "from 3"
				},
				objectName: "RC:TxtMsg",
				senderUserId: "3",
				receivedTime: 1501040183645,
				targetId: "2"
			},
			left: 0
		}
	}

	window.mockNewMsgUp = {
		result: {
			message: {
				extra: "",
				sentStatus: "SENT",
				messageId: 21,
				sentTime: 1501040183448,
				conversationType: "PRIVATE",
				messageDirection: "RECEIVE",
				receivedStatus: "UNREAD",
				content: {
					extra: "helloExtra",
					text: "from 3"
				},
				objectName: "RC:TxtMsg",
				senderUserId: "3",
				receivedTime: 1501040183645,
				targetId: "10"
			},
			left: 0
		}
	}

	window.mockConvList = {
		status: "success",
		result: [
			{
				targetId: "12",
				conversationTitle: "",
				sentStatus: "SENT",
				latestMessage: {
					extra: "helloExtra",
					text: "haha"
				},
				conversationType: "PRIVATE",
				receivedStatus: "UNREAD",
				sentTime: 1507629704286,
				objectName: "RC:TxtMsg",
				senderUserId: "2",
				unreadMessageCount: 18,
				receivedTime: 1507629704286,
				isTop: false,
				latestMessageId: 19,
				draft: ""
			},
			{
				targetId: "10",
				conversationTitle: "",
				sentStatus: "SENT",
				latestMessage: {
					extra: "helloExtra",
					text: "hello, shad eis ata eq d oa tada  adao adagli qqweasd gaxx asgage"
				},
				conversationType: "PRIVATE",
				receivedStatus: "READ",
				sentTime: 1500954249580,
				objectName: "RC:TxtMsg",
				senderUserId: "1",
				unreadMessageCount: 0,
				receivedTime: 1500954250818,
				isTop: false,
				latestMessageId: 1,
				draft: ""
			}
		]
	}

	// 这个
	window.mockSentMsg = {
		extra: "",
		sentStatus: "SENDING",
		messageId: 20,
		sentTime: 1502595800350,
		conversationType: "PRIVATE",
		messageDirection: "SEND",
		receivedStatus: "UNREAD",
		content: {
			extra: "",
			text: "dd"
		},
		objectName: "RC:TxtMsg",
		senderUserId: "2278",
		receivedTime: 0,
		targetId: "1"
	}

	window.mockReplyList = [
	    // 存储的是 payload.action (app自己加的dateline字段)
		{
			action: 1,
			replyinfo: {
				uid: "2280",
				username: "notecodey",
				content: "都觉得就地解决，啊打发阿斯顿发生打发斯蒂芬阿斯顿发生多发点 我你是飒飒多"
			},
			threadinfo: {
				uid: "2278",
				tid: "388",
				title: "发帖",
				username: "notecodex"
			},
			dateline: 1502182692,
		}
	]

	
	window.mockLaudList = [{
			"tid": "50338",
			"recommenduid": "18790",
			"dateline": "1521207912",
			"gid": "1283",
			"avatar": "http:\/\/ouvvqxgwo.bkt.clouddn.com\/qiniu_avatar\/app1\/000\/01\/87\/90_avatar_3.jpg?imageView2\/2\/w\/120\/h\/120",
			"postinfo": {
				"tid": "50338"
			},
			"recommondinfo": {
				"uid": "18790",
				"author": "\u81ea\u5a31\u81ea\u4e50\u81ea\u5df1\u8fc7"
			},
			"isthread": "post"
		}, {
			"tid": "23937",
			"pid": "141713",
			"uid": "330",
			"attitude": "1",
			"dateline": "1521369059",
			"gid": "1283",
			"avatar": "http:\/\/www.ikongji.com\/uc_server\/.\/data\/avatar\/000\/00\/03\/30_avatar_middle.jpg",
			"postinfo": {
				"tid": "23937"
			},
			"recommondinfo": {
				"uid": "330",
				"author": "\u75af\u59d1\u59d1"
			}
		}, {
			"tid": "50338",
			"recommenduid": "13873",
			"dateline": "1521606732",
			"gid": "1283",
			"avatar": "http:\/\/www.ikongji.com\/uc_server\/.\/data\/avatar\/000\/01\/38\/73_avatar_middle.jpg",
			"postinfo": {
				"tid": "50338"
			},
			"recommondinfo": {
				"uid": "13873",
				"author": "\u4f60\u7785\u5565"
			},
			"isthread": "post"
		}, {
			"tid": "50338",
			"pid": "378205",
			"uid": "1911",
			"attitude": "1",
			"dateline": "1521635862",
			"gid": "1283",
			"avatar": "http:\/\/ouvvqxgwo.bkt.clouddn.com\/qiniu_avatar\/app1\/000\/00\/19\/11_avatar_19.jpg?imageView2\/2\/w\/120\/h\/120",
			"postinfo": {
				"tid": "50338"
			},
			"recommondinfo": {
				"uid": "1911",
				"author": "notecoexy1"
			}
		}]


    function fooNewMsgUp() {
    	onSuccRecv(mockNewMsgUp);
    }
    function fooNewMsgPrepend() {
    	onSuccRecv(mockNewMsgPrepend);
    }

    function fooSendMsg() {
    	updateIMListByRongMsg(mockSentMsg, false, true);
    }

	apiready();
	fooLaudItem();
	fooReplyItem();
    fooNewMsgUp();
</script>
